<?php
//$_GET;
//var_dump($_POST);
$id=$_POST['id'];
//$title=$_POST['title'];
//$type_id=$_POST['type_id'];
//$content=$_POST['content'];
//$img=$_POST['img'];
$username=$_POST['username'];
$money=$_POST['money'];
$information=$_POST['information'];
$school=$_POST['school'];
//参考：https://www.cnblogs.com/52fhy/p/5352304.html

require "connect.php";


//文件上传
//1.不上传
//if (!empty($_FILES['pic'])){
//    //2.上传新的
//    $file=$_FILES['pic'];
//    move_uploaded_file($file['tmp_name'],'./uploads/'.$file['name']);
//    $icon=$file['name'];
//}

//$file=$_FILES['pic'];
//move_uploaded_file($file['tmp_name'],'./uploads/'.$file['name']);
$icon=$_POST['pic'];
//3、增加
//if ($icon){
//    $sql="UPDATE news SET title='$title',content='$content',img='$icon',type_id=$type_id WHERE id=$id";
//}else{
//    $sql="UPDATE news SET title='$title',content='$content',img='$img',type_id=$type_id WHERE id=$id";
//}
//if ($icon){
//    $sql="UPDATE infors SET username='$username',money='$money',information='$information',school='$school' WHERE id=$id";
//}else{
//    $sql="UPDATE news SET title='$title',content='$content',img='$img',type_id=$type_id WHERE id=$id";
//}
//$sql="UPDATE `user` SET `name`='$name',age=$age,icon='$icon',type=$type,birthday='$birthday' WHERE id=$id";
$sql="UPDATE infors SET money='$money',information='$information',school='$school' WHERE id=$id";
//var_dump($sql);
$count=$pdo->exec($sql);
//var_export($count);
if($count>=1){
    echo "<script>alert('修改成功！');location.href='../mine.html'</script>>";
}else{
    echo "<script>alert('修改失败！');history.go(-1)</script>>";
}
var_dump($count);
